;(function(){
$.ajax({
    url: "data/data4.json", //json文件位置
    type: "get",
    dataType: "json", //返回数据格式为json
    success: function (data4){
        var chartDom = document.getElementById('main4');
          var myChart = echarts.init(chartDom,'dark');
        //   var myChart = echarts.init(chartDom);
          var option;
        
        var data = [];
        // Parametric curve
        for (var t = 0; t < 25; t += 0.001) {
            var x = (1 + 0.25 * Math.sin(75 * t)) * Math.cos(t);
            var y = (1 + 0.25 * Math.sin(75 * t)) * Math.sin(t);
            var z = t + 2.0 * Math.sin(75 * t);
            data.push([x, y, z]);
        }
        console.log(data.length);
        
        option = {
			title: {
			  text: '3D曲面图',
			  left: 'center'
			},
            tooltip: {},
            // darkMode: true,
            visualMap: {
                show: true,
                dimension: 2,
                min: 0,
                max: 30,
                inRange: data4.mycolor
            },
            xAxis3D: {
                type: 'value'
            },
            yAxis3D: {
                type: 'value'
            },
            zAxis3D: {
                type: 'value'
            },
            grid3D: {
                viewControl: {
                    projection: 'orthographic'
                }
            },
            series: [{
                type: 'line3D',
                data: data,
                lineStyle: {
                    width: 4
                }
            }]
        };
        option && myChart.setOption(option);
        window.onresize = myChart.resize;
    }
})

})();